package com.lenovo.study.controller;

import com.lenovo.study.service.SecKillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Author: fuxh3@lenovo.com
 * Date: Created in 2018/2/8 0008
 */
@RestController
@RequestMapping(value = "/sec")
public class SecKillController {
    @Autowired SecKillService secKillService;
    @RequestMapping(value = "/shopping")
    public String shopping(@RequestParam("user_id") String user_id){
        Boolean res = secKillService.check_stock(user_id);
        if(res){
            return "恭喜抢购成功";
        }
        return "sorry，货已抢光";
    }
}
